package com.demo.designpattern.singleton;

/**
 * Created by hunter
 *
 * @Description 单例模式
 */
public class MainTest {

    public static void main(String[] args) {
        for (int i = 0; i < 30; i++) {
            new Thread(EnumSingleton.INSTANCE::toString).start();
        }

        for (int i = 0; i < 30; i++) {
            new Thread(InnerClassSingleton.InstanceHolder.INSTANCE::toString).start();
        }

        for (int i = 0; i < 30; i++) {
            new Thread(SlackerSingleton.getINSTANCE()::toString).start();
        }

        for (int i = 0; i < 30; i++) {
            new Thread(StarvingSingleton.getInstance()::toString).start();
        }
    }
}
